from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from mhlandscaping.apps.world.models import Map
from django.views.decorators.cache import cache_page
import settings

def about(request):
    return render_to_response('world/templates/about.html', 
                              {}, 
                              context_instance=RequestContext(request))

@cache_page(settings.CACHE_LENGTH, key_prefix="area")
def area(request):
    map = []
    try:
        map = Map.objects.all()[:1][0]
    except Map.DoesNotExist:
        raise Http404
    
    print map.latitude
    
    return render_to_response('world/templates/area.html', 
                              { 'map': map }, 
                              context_instance=RequestContext(request))